<template>
  <div class="m-25 mt-65">
    <div class="normal-box-mod">
      <div class="normal-box-hd clearfix">
        <div class="normal-box-title">
          <div class="decorate-square"></div>
          <h2>ATM发放机平台返回码参照</h2>
        </div>
      </div>
      <Card style="margin-bottom: 10px;">
        <div class="normal-list-page-hd clearfix">
            <Input class="mr-10" placeholder="错误码" v-model="queryData.msgCode" style="width:200px;" />
            <Button type="primary" custom-icon="iconfont icon-chaxun" size="small" @click="inQuire">查询</Button>
        </div>
      </Card>
      <div class="normal-box-bd">
        <div class="normal-list-page-mod">
          <div class="normal-list-page-bd">
            <Table border :loading="list.loading" :columns="list.columns" :data="list.tableData"></Table>
          </div>
          <div>
            <Page :total="queryData.totalRecord" :page-size="queryData.pageSize" :current="queryData.page" show-total
              show-elevator @on-change="changePage"></Page>
            <!-- <span style="float: right;">共{{queryData.totalRecord}}条数据</span> -->
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import ATMApi from "@/api/base_sys/ATMrecord.js";
// import moment from "moment";
import {Message} from "iview";
import city from "@/view/test/city.vue"

  export default {
    components: {
      city
    },
    data() {
      return {
        url: '/api/ckFafangMsgcode/list',
        // 列表
        list: {
          loading: false,
          selections: [],
          // 列表展示数据
          tableData: [],
          // 表格表头
          columns: [{
              title: "返回码编码",
              key: "msgCode",
              align: "center",
              minWidth:100
            },
            {
              title: "返回码描述",
              key: "msgDesc",
              align: "center",
              minWidth:500
            },
            {
              title: "操作时间",
              key: "insertTime",
              align: "center",
              minWidth:100
            },
            {
              title: "操作人",
              key: "insertName",
              align: "center",
              minWidth:100
            }
          ]
        },
        // 页面查询数据
        queryData: {
            limit: 10,
            page: 1,
            totalRecord: 0,
            msgCode: '', // 错误码
        }
      }
    },
    created() {
      let area = window.defArea
      this.queryData.provid = area[0]
      this.queryData.cityid = area[1]
      this.queryData.distid = area[2]
      this.getTableData();
    },
    methods: {
      click() {
        let getCities = this.value;
      },
      // 获取列表
      async getTableData() {
        console.log(this.queryData);
        this.queryData.totalRecord = undefined;
        let result = await ATMApi.getList(this.url,this.queryData)
        console.log(result);
        // return
        this.list.tableData = result.data.list;
        this.queryData.totalRecord = result.data.totalRecord;
        this.queryData.limit = result.data.pageSize;
      },
      //查询
      inQuire() {
		this.queryData.page=1;
        this.getTableData();
      },
      //每页显示记录数变更
      onPageSizeChange(pageSize) {
        this.queryData.limit = pageSize;
        this.getTableData();
      },
      // 换页
      changePage(page) {
        this.queryData.page = page;
        this.getTableData();
      },
    },

    
  };
</script>
